import com.gargoylesoftware.htmlunit.util.NameValuePair
/**
 * Created by IntelliJ IDEA.
 * User: AlexandruA
 * Date: 6/16/11
 * Time: 6:23 PM
 * To change this template use File | Settings | File Templates.
 */
class QueryString {
    Map params = [:]


    QueryString(Map params) {
        if(params){
            this.params.putAll(params);
        }
    }

    void add(String name, String value){
        params.put(name, value);
    }

    List<NameValuePair> getParams(){
        def list = [];
        params.each{name, value ->
            value.split(",").each {it->
                list << new NameValuePair(name, it); //URLEncoder.encode(it));
            }

        }
        return list;
    }
}
